package com.sz.mes.schedule;

import com.sz.mes.service.WorkHoursService;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.ParseException;


@Configuration
@EnableScheduling
@Component
@RequiredArgsConstructor
public class WorkHoursSchedule {
    private final WorkHoursService workHoursService;


    @Scheduled(cron = "0 2 0 * * ?")
    public void saveDailyWorkHours() throws ParseException {
        workHoursService.workHoursCount();
    }
}
